@use './styles/variables' as *;
@use './styles/components' as *;

// 全局样式重置
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.5;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f5f5;
  color: #262626;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

// 滚动条样式
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
  
  &:hover {
    background: #a8a8a8;
  }
}

// 选择文本样式
::selection {
  background-color: rgba(24, 144, 255, 0.2);
  color: #262626;
}

// 焦点样式
:focus {
  outline: 2px solid #1890ff;
  outline-offset: 2px;
}

// 链接样式
a {
  color: #1890ff;
  text-decoration: none;
  transition: color 0.3s ease;
  
  &:hover {
    color: #40a9ff;
    text-decoration: underline;
  }
  
  &:focus {
    outline: 2px solid #1890ff;
    outline-offset: 2px;
  }
}

// 按钮基础样式
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  
  &:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }
}

// 输入框基础样式
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

// 图片样式
img {
  max-width: 100%;
  height: auto;
}

// 表格样式
table {
  border-collapse: collapse;
  width: 100%;
}

// 无障碍支持
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

// 动画性能优化
* {
  will-change: auto;
}

.animate-transform {
  will-change: transform;
}

.animate-opacity {
  will-change: opacity;
}

// 减少动画（用户偏好）
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
